package com.pullzoomview;

import android.app.Activity;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.View;
import android.widget.AbsListView;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;

import com.pullzoomview.widget.pulltozoomview.PullToZoomListViewEx;

/**
 * Author: dengdayi
 * Date: 2015/11/5 10:20
 * Description:
 */
public class PullToZoomListActivity extends Activity {

    private PullToZoomListViewEx listView;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_pull_to_zoom_list_view);
        initView();
    }

    private void initView() {
        listView = (PullToZoomListViewEx) findViewById(R.id.listview);

        String[] adapterData = new String[]{"撤回老师减肥", "就开饭了都是风景", "隧道；福建省凉快的", "；手机发了多少发",
                "但是；负借口水电费水电费", "是；房间都是路口附近的上了飞机T", "是；减肥的事了空间发的是李开复的事发大水了房间", "HttpClient"
        };

        listView.setAdapter(new ArrayAdapter<String>(PullToZoomListActivity.this, android.R.layout.simple_list_item_1, adapterData));
        listView.getPullRootView().setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                Log.e("zhuwenwu", "position = " + position);
            }
        });

        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                Log.e("zhuwenwu", "position = " + position);
            }
        });

        DisplayMetrics localDisplayMetrics = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(localDisplayMetrics);
        int mScreenHeight = localDisplayMetrics.heightPixels;
        int mScreenWidth = localDisplayMetrics.widthPixels;
        AbsListView.LayoutParams localObject = new AbsListView.LayoutParams(mScreenWidth, (int) (9.0F * (mScreenHeight / 16.0F)));
        listView.setHeaderLayoutParams(localObject);
    }
}
